type Animal = "cat" | "dog" | "dolphin";

function handleAnimal(animal: Animal) {
  switch (animal) {
    case "cat":
      console.log("It's a cat.");
      break;
    case "dog":
      console.log("It's a dog.");
      break;
    case "dolphin":
      console.log("It's a dolphin.");
      break;
    default:
      // 这里的 never 类型确保我们已经处理了所有可能的情况
      const exhaustiveCheck: never = animal;
      throw new Error(`Unhandled case: ${exhaustiveCheck}`);
  }
}

